
package com.xinzhi.controller;

import com.xinzhi.pojo.User;
import com.xinzhi.service.UserService;
import com.xinzhi.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin(origins = "http://localhost:8090")
/**
 * 登录注册接口
 */
public class UserController {
    @Autowired
    private  UserService userService;

    //登录
    @GetMapping("/login")
    public Result login(String account, String password){
        return userService.login(account,password);
    }

    //注册
    @PostMapping("/register")
    public Result register(@RequestBody User user){
        return userService.insertUser(user);
    }
}